package com.huiyu.demo.service;

import com.huiyu.demo.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 需求: 完善groupUser和groupUserAndFillPhone方法
 */
@Service
public class UserService {

    @Autowired
    private CustomerService customerService;
    /**
     * 按照年龄分组, 30岁以下为"青年组", 30岁以上为"中年组", 过滤掉已删除(deleted=true)或不可用(enabled=false)用户
     */
    public Map<String, List<User>> groupUser(List<User> userList) {
        //TODO:
        customerService.getCustomerCodeFromApi(Arrays.asList("abc", "123"));
        return null;
    }

    /**
     * 按照年龄分组, 30岁以下为"青年组", 30岁以上为"中年组", 过滤掉已删除或不可用用户，并填充号码
     * 号码从CustomerService.getCustomerCodeFromApi 获取
     */
    public Map<String, List<User>> groupUserAndFillPhone(List<User> userList) {
        //TODO:

        return null;
    }
}
